import { createRouter, createWebHashHistory } from 'vue-router'

//导入组件
import left from './components/test/left.vue'
import right from './components/test/right.vue'
import video from './components/video/video.vue'
import videoinfo from './components/video/videoinfo.vue'
import videoorder from './components/video/videoorder.vue'

//创建路由实例
const router = createRouter({
    //路由被激活时，显示的样式，可以自定义一个样式
    linkActiveClass: 'router-active',

    history: createWebHashHistory(),
    routes: [
        // 可以重定向配置
        { path: '/', redirect: 'right' },
        { path: '/left', component: left },
        { path: '/right', component: right },
        { path: '/video', component: video, 
            children:[
                {
                    path:':id',
                    component: videoinfo,
                    props:true,
                    children:[
                        {
                            path:':orderid',
                            component: videoorder,
                            props:true
                        }
                    ]
                },
               
            ]
        },
    ]
})

//懒加载的方式
//   const router = createRouter({
//     history: createWebHashHistory(),
//     routes: [
//       { path: '/home', component: () => import('./components/Home.vue') },
//       { path: '/about', component: () => import('./components/About.vue') },
//     ]
//   })


export default router;